# -*- coding: utf-8 -*-

from libs import yaml
# import pprint as pp
import subprocess,os

def main():
	data = dict()
	with open(os.path.join(config_path,'Maya2018_env.yaml'),'r') as f:
		data = yaml.load(f)
		# pp.pprint(data)
	_env = os.environ.copy() #- ENV_NAME:ENV_VALUE
	for e in data['Env']:
		if e['mode'] == 'over':
			_env[e['name']] = e['value']

		elif e['mode'] == 'pre':
			_env[e['name']] = e['value'] + ";" + os.environ.get(e['name'],'')

		elif e['mode'] == 'post':
			_env[e['name']] = os.environ.get(e['name'],'') + ";"+ e['value']

		else:
			pass
	subprocess.Popen(data['Exec'],env = _env)

# if __name__ == '__main__':
# 	main()


